﻿using CommunityToolkit.Mvvm.ComponentModel;
using Newtonsoft.Json.Linq;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Media;
using System.Windows.Media.Animation;
using 充电桩上位机.Model.FTRegisters;
using 充电桩上位机.Model.PTAConfig;
using 充电桩上位机.ViewModel.SerialPortConnection;

namespace 充电桩上位机.ViewModel.FTRegisters;

public class FTRegistersViewModel : ObservableObject
{
    public static string _appStartupPath = Path.GetDirectoryName(Environment.ProcessPath)!;

    private string _signalpictureaddress = new(Path.Combine
                        (_appStartupPath!, @"Assets/SignalValue.png"));
    private string _duopictureaddress = new(Path.Combine
                        (_appStartupPath!, @"Assets/DuoValue.png"));

    [Category("直流输出最大电压能力")]
    private string _maxDCVoltage = string.Empty;
    public string MaxDCVoltage
    {
        get => _maxDCVoltage;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _maxDCVoltage, value);
        }
    }
    [Category("直流输出最小电压能力")]
    private string _minDCVoltage = string.Empty;
    public string MinDCVoltage
    {
        get => _minDCVoltage;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _minDCVoltage, value);
        }
    }
    [Category("直流输出最大电流能力")]
    private string _maxDCCurrent = string.Empty;
    public string MaxDCCurrent
    {
        get => _maxDCCurrent;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _maxDCCurrent, value);
        }
    }
    [Category("直流输出最小电流能力")]
    private string _minDCCurrent = string.Empty;
    public string MinDCCurrent
    {
        get => _minDCCurrent;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _minDCCurrent, value);
        }
    }
    [Category("交流输入额定相电压 L-N")]
    private string _aCLN = string.Empty;
    public string ACLN
    {
        get => _aCLN;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _aCLN, value);
        }
    }
    [Category("是否启用网络安全策略")]
    private bool _netWorkSecurity = false;
    public bool NetWorkSecurity
    {
        get => _netWorkSecurity;
        set => SetProperty(ref _netWorkSecurity, value);
    }
    [Category("硬件是否具备水浸传感器")]
    private bool _waterImmersion = false;
    public bool WaterImmersion
    {
        get => _waterImmersion;
        set => SetProperty(ref _waterImmersion, value);
    }
    [Category("硬件是否具备倾斜传感器")]
    private bool _dumping = false;
    public bool Dumping
    {
        get => _dumping;
        set => SetProperty(ref _dumping, value);
    }
    [Category("硬件是否具备烟雾传感器")]
    private bool _smog = false;
    public bool Smog
    {
        get => _smog;
        set => SetProperty(ref _smog, value);
    }
    [Category("硬件是否具备湿度传感器")]
    private bool _humiditySensor = false;
    public bool HumiditySensor
    {
        get => _humiditySensor;
        set => SetProperty(ref _humiditySensor, value);
    }
    [Category("硬件是否具备POS机")]
    private bool _pOS = false;
    public bool POS
    {
        get => _pOS;
        set => SetProperty(ref _pOS, value);
    }
    [Category("硬件是否具备加热器")]
    private bool _heater = false;
    public bool Heater
    {
        get => _heater;
        set => SetProperty(ref _heater, value);
    }
    [Category("风扇数量")]
    private string _numberFans = string.Empty;
    public string NumberFans
    {
        get => _numberFans;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
            {
                SetProperty(ref _numberFans, value);
            }
        }
    }
    [Category("风扇Without反馈")]
    private bool _withoutChecked = false;
    public bool WithoutChecked
    {
        get => _withoutChecked;
        set => SetProperty(ref _withoutChecked, value);
    }
    [Category("风扇PWM反馈")]
    private bool _pWMChecked = false;
    public bool PWMChecked
    {
        get => _pWMChecked;
        set => SetProperty(ref _pWMChecked, value);
    }
    [Category("风扇RD反馈")]
    private bool _rDChecked = false;
    public bool RDChecked
    {
        get => _rDChecked;
        set => SetProperty(ref _rDChecked, value);
    }
    [Category("图片默认显示信息")]
    private string _pictureSource = string.Empty;
    public string PictureSource
    {
        get => _pictureSource;
        set => SetProperty(ref _pictureSource, value);
    }

    [Category("双枪颜色")]
    private Brush _signalColor = Brushes.Black;
    public Brush SignalColor
    {
        get => _signalColor;
        set => SetProperty(ref _signalColor, value);
    }
    [Category("双枪颜色")]
    private Brush _duoColor = Brushes.Black;
    public Brush DuoColor
    {
        get => _duoColor;
        set => SetProperty(ref _duoColor, value);
    }

    [Category("单枪按下状态")]
    private bool _signaleChecked = true;
    public bool SignaleChecked
    {
        get => _signaleChecked;
        set
        {
            if (value)
            {
                SignalColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2563EB"));
                DuoColor = Brushes.Black;
            }
            else
            {
                DuoColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2563EB"));
                SignalColor = Brushes.Black;
            }
            PictureSource = value ? _signalpictureaddress : _duopictureaddress;
            DuoValueVisibity = !value ? 32 : 0;
            SignalValueVisibity = value ? 32 : 0;
            SetProperty(ref _signaleChecked, value);
        }
    }
    [Category("双枪按下状态")]
    private bool _duoChecked = true;
    public bool DuoChecked
    {
        get => _duoChecked;
        set => SetProperty(ref _duoChecked, value);
    }
    [Category("单枪状态")]
    private int _signalValueVisibity = 32;
    public int SignalValueVisibity
    {
        get => _signalValueVisibity;
        set => SetProperty(ref _signalValueVisibity, value);
    }

    [Category("多枪状态")]
    private int _duoValueVisibity = 0;
    public int DuoValueVisibity
    {
        get => _duoValueVisibity;
        set => SetProperty(ref _duoValueVisibity, value);
    }
    [Category("单枪模块数量1")]
    private string _signalMode1 = string.Empty;
    public string SignalMode1
    {
        get => _signalMode1;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new (pattern);
            if (regex.IsMatch(value) || value == "")
                SetProperty(ref _signalMode1, value);
        }
    }
    [Category("单枪模块数量2")]
    private string _signalMode2 = string.Empty;
    public string SignalMode2
    {
        get => _signalMode2;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value) || value == "")
                SetProperty(ref _signalMode2, value);
        }
    }
    [Category("双枪模块数量1")]
    private string _duoMode1 = string.Empty;
    public string DuoMode1
    {
        get => _duoMode1;
        set
        {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value) || value == "")
                SetProperty(ref _duoMode1, value);
        }
    }
    [Category("双枪模块数量2")]
    private string _duoMode2 = string.Empty;
    public string DuoMode2
    {
        get => _duoMode2;
        set
        {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value) || value == "")
                SetProperty(ref _duoMode2, value);
        }
    }
    [Category("双枪模块数量3")]
    private string _duoMode3 = string.Empty;
    public string DuoMode3
    {
        get => _duoMode3;
        set
        {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value) || value == "")
                SetProperty(ref _duoMode3, value);
        }
    }
    [Category("双枪模块数量4")]
    private string _duoMode4 = string.Empty;
    public string DuoMode4
    {
        get => _duoMode4;
        set
        {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value) || value == "")
                SetProperty(ref _duoMode4, value);
        }
    }
    [Category("直流输出最大电压能力枪2")]
    private string _maxDCVoltageGun2 = string.Empty;
    public string MaxDCVoltageGun2
    {
        get => _maxDCVoltageGun2;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _maxDCVoltageGun2, value);
        }
    }
    [Category("直流输出最小电压能力枪2")]
    private string _minDCVoltageGun2 = string.Empty;
    public string MinDCVoltageGun2
    {
        get => _minDCVoltageGun2;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _minDCVoltageGun2, value);
        }
    }
    [Category("直流输出最大电流能力枪2")]
    private string _maxDCCurrentGun2 = string.Empty;
    public string MaxDCCurrentGun2
    {
        get => _maxDCCurrentGun2;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _maxDCCurrentGun2, value);
        }
    }
    [Category("直流输出最小电流能力枪2")]
    private string _minDCCurrentGun2 = string.Empty;
    public string MinDCCurrentGun2
    {
        get => _minDCCurrentGun2;
        set
        {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _minDCCurrentGun2, value);
        }
    }
    [Category("交流输入额定相电压 L-N 枪3")]
    private string _aCLNGun3 = string.Empty;
    public string ACLNGun3
    {
        get => _aCLNGun3;
        set {
            string pattern = @"^-?\d+$";
            Regex regex = new(pattern);
            if (regex.IsMatch(value))
                SetProperty(ref _aCLNGun3, value);
        }
    }
    [Category("触摸屏灵敏度")]
    private int _touchScreenSensitivity = 5;
    public int TouchScreenSensitivity
    {
        get => _touchScreenSensitivity;
        set => SetProperty(ref _touchScreenSensitivity, value);
    }
    [Category("出厂序列号")]
    private string _serialNumber = string.Empty;
    public string SerialNumber
    {
        get => _serialNumber;
        set => SetProperty(ref _serialNumber, value);
    }
    [Category("雷达传感器")]
    private bool _radarSensor = false;
    public bool RadarSensor
    {
        get => _radarSensor;
        set => SetProperty(ref _radarSensor, value);
    }
    [Category("液冷泵")]
    private bool _liquidCoolingPump = false;
    public bool LiquidCoolingPump
    {
        get => _liquidCoolingPump;
        set => SetProperty(ref _liquidCoolingPump, value);
    }
    [Category("温度传感器启动")]
    private bool _tempSensor = false;
    public bool TempSensor
    {
        get => _tempSensor;
        set => SetProperty(ref _tempSensor, value);
    }
    [Category("UU模块功率40kw")]
    private bool _signaleWind_1 = false;
    public bool SignaleWind_1
    {
        get => _signaleWind_1;
        set => SetProperty(ref _signaleWind_1, value);
    }
    [Category("UU模块功率30kw")]
    private bool _signaleWind_2 = false;
    public bool SignaleWind_2
    {
        get => _signaleWind_2;
        set => SetProperty(ref _signaleWind_2, value);
    }
    [Category("UU模块功率20kw(独立风道)")]
    private bool _signaleWind_3 = false;
    public bool SignaleWind_3
    {
        get => _signaleWind_3;
        set => SetProperty(ref _signaleWind_3, value);
    }
    [Category("GBT 24V辅助电源")]
    private bool _gBTHelpVoltage = false;
    public bool GBTHelpVoltage
    {
        get => _gBTHelpVoltage;
        set => SetProperty(ref _gBTHelpVoltage, value);
    }
    [Category("PTB 电表")]
    private bool _pTBElc = false;
    public bool PTBElc
    {
        get => _pTBElc;
        set => SetProperty(ref _pTBElc, value);
    }
    //check gone 
    [Category("上位机界面标题")]
    private ObservableCollection<HelpFTRegistersModel> _fTRegistersList = new();
    public ObservableCollection<HelpFTRegistersModel> FTRegistersList
    {
        get => _fTRegistersList;
        set => SetProperty(ref _fTRegistersList, value);
    }

    private string _uLockToggle = string.Empty;
    public string ULockToggle
    {
        get => _uLockToggle;
        set => SetProperty(ref _uLockToggle, value);
    }
    private static bool _uLockState = false;
    public bool ULockState
    {
        get => _uLockState;
        set { 
            if (value && !_uLockState)
            {
                //解锁下发送内容
                var _ = MainWindowViewModel.StrignToUShort("#FT Unlock", 10, false);
                SerialPortConnectionViewModel.
                    iAQBHController.AQBHSendData(MainWindowViewModel.theslaveaddr, 0xFF00, _);

            }
            MainWindowViewModel.pTAConfigModel!.硬件解锁 = value;
            SetProperty(ref _uLockState, value); 
        }
    }
    
    #region 全球化
    private string _fT_Regisiter_Text = string.Empty;
    public string FT_Regisiter_Text
    {
        get => _fT_Regisiter_Text;
        set => SetProperty(ref _fT_Regisiter_Text, value);
    }
    private string _connector__Type_Text = string.Empty;
    public string Connector__Type_Text
    {
        get => _connector__Type_Text;
        set => SetProperty(ref _connector__Type_Text, value);
    }
    private string _sigle_shot_Text = string.Empty;
    public string Sigle_shot_Text
    {
        get => _sigle_shot_Text;
        set => SetProperty(ref _sigle_shot_Text, value);
    }
    private ObservableCollection<string> _fTRegOptionList = new();
    public ObservableCollection<string> FTRegOptionList
    {
        get => _fTRegOptionList;
        set => SetProperty(ref _fTRegOptionList, value);
    }

    private string _gun_1_Text = string.Empty;
    public string Gun_1_Text
    {
        get => _gun_1_Text;
        set => SetProperty(ref _gun_1_Text, value);
    }
    private string _gun_2_Text = string.Empty;
    public string Gun_2_Text
    {
        get => _gun_2_Text;
        set => SetProperty(ref _gun_2_Text, value);
    }
    private string _gun_3_Text = string.Empty;
    public string Gun_3_Text
    {
        get => _gun_3_Text;
        set => SetProperty(ref _gun_3_Text, value);
    }
    private string _dC_Output_Max_Vol_Cap = string.Empty;
    public string DC_Output_Max_Vol_Cap
    {
        get => _dC_Output_Max_Vol_Cap;
        set => SetProperty(ref _dC_Output_Max_Vol_Cap, value);
    }
    private string _dC_Output_Min_Vol_Cap = string.Empty;
    public string DC_Output_Min_Vol_Cap
    {
        get => _dC_Output_Min_Vol_Cap;
        set => SetProperty(ref _dC_Output_Min_Vol_Cap, value);
    }
    private string _dC_Output_Max_Cur_Cap = string.Empty;
    public string DC_Output_Max_Cur_Cap
    {
        get => _dC_Output_Max_Cur_Cap;
        set => SetProperty(ref _dC_Output_Max_Cur_Cap, value);
    }
    private string _dC_Output_Min_Cur_Cap = string.Empty;
    public string DC_Output_Min_Cur_Cap
    {
        get => _dC_Output_Min_Cur_Cap;
        set => SetProperty(ref _dC_Output_Min_Cur_Cap, value);
    }
    private string _aC_Input_Rate_Vol_LN = string.Empty;
    public string AC_Input_Rate_Vol_LN
    {
        get => _aC_Input_Rate_Vol_LN;
        set => SetProperty(ref _aC_Input_Rate_Vol_LN, value);
    }
    private string _power_distribution_model = string.Empty;
    public string Power_distribution_model
    {
        get => _power_distribution_model;
        set => SetProperty(ref _power_distribution_model, value);
    }
    private string _second_Machine_Text = string.Empty;
    public string Second_Machine_Text
    {
        get => _second_Machine_Text;
        set => SetProperty(ref _second_Machine_Text, value);
    }
    private string _fourth_Machine_Text = string.Empty;
    public string Fourth_Machine_Text
    {
        get => _fourth_Machine_Text;
        set => SetProperty(ref _fourth_Machine_Text, value);
    }
    private string _netWorkSecurity_Text = string.Empty;
    public string NetWorkSecurity_Text
    {
        get => _netWorkSecurity_Text;
        set => SetProperty(ref _netWorkSecurity_Text, value);
    }
    private string _water_Immersion_Text = string.Empty;
    public string Water_Immersion_Text
    {
        get => _water_Immersion_Text;
        set => SetProperty(ref _water_Immersion_Text, value);
    }
    private string _dumping_Text = string.Empty;
    public string Dumping_Text
    {
        get => _dumping_Text;
        set => SetProperty(ref _dumping_Text, value);
    }
    private string _smog_Text = string.Empty;
    public string Smog_Text
    {
        get => _smog_Text;
        set => SetProperty(ref _smog_Text, value);
    }
    private string _humidity_Sensor_Text = string.Empty;
    public string Humidity_Sensor_Text
    {
        get => _humidity_Sensor_Text;
        set => SetProperty(ref _humidity_Sensor_Text, value);
    }
    private string _pOS_Text = string.Empty;
    public string POS_Text
    {
        get => _pOS_Text;
        set => SetProperty(ref _pOS_Text, value);
    }
    private string _heater_Text = string.Empty;
    public string Heater_Text
    {
        get => _heater_Text;
        set => SetProperty(ref _heater_Text, value);
    }
    private string _radar_Sensor_Text = string.Empty;
    public string Radar_Sensor_Text
    {
        get => _radar_Sensor_Text;
        set => SetProperty(ref _radar_Sensor_Text, value);
    }
    private string _liquid_Cooling_Pump_Text = string.Empty;
    public string Liquid_Cooling_Pump_Text
    {
        get => _liquid_Cooling_Pump_Text;
        set => SetProperty(ref _liquid_Cooling_Pump_Text, value);
    }
    private string _temp_Sensor_Text = string.Empty;
    public string Temp_Sensor_Text
    {
        get => _temp_Sensor_Text;
        set => SetProperty(ref _temp_Sensor_Text, value);
    }
    private string _gBT_auxiliary_power_supply_Text = string.Empty;
    public string GBT_auxiliary_power_supply_Text
    {
        get => _gBT_auxiliary_power_supply_Text;
        set => SetProperty(ref _gBT_auxiliary_power_supply_Text, value);
    }
    private string _pTB_electric_meter_Text = string.Empty;
    public string PTB_electric_meter_Text
    {
        get => _pTB_electric_meter_Text;
        set => SetProperty(ref _pTB_electric_meter_Text, value);
    }
    private string _number_of_fans_Text = string.Empty;
    public string Number_of_fans_Text
    {
        get => _number_of_fans_Text;
        set => SetProperty(ref _number_of_fans_Text, value);
    }
    private string _without_feedback_Text = string.Empty;
    public string Without_feedback_Text
    {
        get => _without_feedback_Text;
        set => SetProperty(ref _without_feedback_Text, value);
    }
    private string _pWM_Text = string.Empty;
    public string PWM_Text
    {
        get => _pWM_Text;
        set => SetProperty(ref _pWM_Text, value);
    }
    private string _rD_Text = string.Empty;
    public string RD_Text
    {
        get => _rD_Text;
        set => SetProperty(ref _rD_Text, value);
    }
    private string _serialNumber_Text = string.Empty;
    public string SerialNumber_Text
    {
        get => _serialNumber_Text;
        set => SetProperty(ref _serialNumber_Text, value);
    }
    private string _touch_Screen_Sensitivity_Text = string.Empty;
    public string Touch_Screen_Sensitivity_Text
    {
        get => _touch_Screen_Sensitivity_Text;
        set => SetProperty(ref _touch_Screen_Sensitivity_Text, value);
    }
    private string _lowest_Text = string.Empty;
    public string Lowest_Text
    {
        get => _lowest_Text;
        set => SetProperty(ref _lowest_Text, value);
    }
    private string _superme_Text = string.Empty;
    public string Superme_Text
    {
        get => _superme_Text;
        set => SetProperty(ref _superme_Text, value);
    }
    #endregion

    public FTRegistersViewModel()
    {
        #region 全球化语言垃圾代码
        FT_Regisiter_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "FT Regisiter");
        Connector__Type_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Connector__Type");
        Sigle_shot_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Sigle shot power/current...");
        FTRegOptionList.Add(MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "The head of th gun doesn't exist."));
        FTRegOptionList.Add(MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC European Standard."));
        FTRegOptionList.Add(MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC National Standard."));
        FTRegOptionList.Add(MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC Japanese Standard."));
        FTRegOptionList.Add(MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "AC European Standard."));
        FTRegOptionList.Add(MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC American Standard."));
        FTRegOptionList.Add(MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC Tesla"));

        Gun_1_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "A Connector");
        Gun_2_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "B Connector");
        Gun_3_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "C Connector");
        DC_Output_Max_Vol_Cap = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC Output Maximum Voltage Capability");
        DC_Output_Min_Vol_Cap = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC Output Minimum Voltage Capability");
        DC_Output_Max_Cur_Cap = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC Output Maximum Current Capability");
        DC_Output_Min_Cur_Cap = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "DC Output Minimum Current Capability");
        AC_Input_Rate_Vol_LN = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "AC Input rated phase voltage L-N");
        Power_distribution_model = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Power distribution model");

        Second_Machine_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "2-section machine");
        Fourth_Machine_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "4-section machine");

        NetWorkSecurity_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "network security");
        Water_Immersion_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Water Immersion");
        Dumping_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Dumping");
        Smog_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Smog");
        Humidity_Sensor_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Humidity Sensor");
        POS_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "POS");
        Heater_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Heater");
        Radar_Sensor_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Radar Sensor");
        Liquid_Cooling_Pump_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Liquid Cooling Pump");
        Temp_Sensor_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Temp Sensor");
        GBT_auxiliary_power_supply_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "GBT 24V auxiliary power supply");
        PTB_electric_meter_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "PTB electric meter");
        Number_of_fans_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Number of fans");
        Without_feedback_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Without feedback");
        PWM_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "PWM");
        RD_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "RD");
        SerialNumber_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Charging pile factory serial..");
        Touch_Screen_Sensitivity_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "Touch Screen Sensitivity");
        Lowest_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "lowest");
        Superme_Text = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "superme");

        ULockToggle = MainWindowViewModel.SetLanguage(MainWindowViewModel.globellanguage, "UnLock FT");
        #endregion
        PictureSource = _signalpictureaddress;
        FTRegistersList.Clear();

        FTRegistersList.Add(MainWindowViewModel.pTAConfigModel!.Connecotr_Type1!);
        FTRegistersList.LastOrDefault()!.TitleName = Gun_1_Text;
        FTRegistersList.LastOrDefault()!.FTRegOptionList = FTRegOptionList;

        FTRegistersList.Add(MainWindowViewModel.pTAConfigModel!.Connecotr_Type2!);
        FTRegistersList.LastOrDefault()!.TitleName = Gun_2_Text;
        FTRegistersList.LastOrDefault()!.FTRegOptionList = FTRegOptionList;

        FTRegistersList.Add(MainWindowViewModel.pTAConfigModel!.Connecotr_Type3!);
        FTRegistersList.LastOrDefault()!.TitleName = Gun_3_Text;
        FTRegistersList.LastOrDefault()!.FTRegOptionList = FTRegOptionList;


        MaxDCVoltage = MainWindowViewModel.pTAConfigModel!.直流输出最大电压能力!;
        MinDCVoltage = MainWindowViewModel.pTAConfigModel!.直流输出最小电压能力!;
        MaxDCCurrent = MainWindowViewModel.pTAConfigModel!.直流输出最大电流能力!;
        MinDCCurrent = MainWindowViewModel.pTAConfigModel!.直流输出最小电流能力!;
        ACLN = MainWindowViewModel.pTAConfigModel!.交流输入额定相电压_L_N!;
        NetWorkSecurity = MainWindowViewModel.pTAConfigModel!.是否启用网络安全策略 ?? false;
        WaterImmersion = MainWindowViewModel.pTAConfigModel!.硬件是否具备水浸传感器 ?? false;
        Dumping = MainWindowViewModel.pTAConfigModel!.硬件是否具备倾斜传感器 ?? false;
        Smog = MainWindowViewModel.pTAConfigModel!.硬件是否具备烟雾传感器 ?? false;
        HumiditySensor = MainWindowViewModel.pTAConfigModel!.硬件是否具备湿度传感器 ?? false;
        POS = MainWindowViewModel.pTAConfigModel!.硬件是否具备POS机 ?? false;
        Heater = MainWindowViewModel.pTAConfigModel!.硬件是否具备加热器 ?? false;
        NumberFans = MainWindowViewModel.pTAConfigModel!.风扇数量!;

        WithoutChecked = MainWindowViewModel.pTAConfigModel!.风扇反馈类型1 ?? false;
        PWMChecked = MainWindowViewModel.pTAConfigModel!.风扇反馈类型2 ?? false;
        RDChecked = MainWindowViewModel.pTAConfigModel!.风扇反馈类型3 ?? false;
        SignaleChecked = MainWindowViewModel.pTAConfigModel!.功率分配模式 ?? false;
        DuoChecked = MainWindowViewModel.pTAConfigModel!.功率分配模式2 ?? false;

        SignalMode1 = MainWindowViewModel.pTAConfigModel!.串联接触器分割的模块数量1!;
        SignalMode2 = MainWindowViewModel.pTAConfigModel!.串联接触器分割的模块数量2!;
        DuoMode1 = MainWindowViewModel.pTAConfigModel!.并联接触器分割的模块数量1!;
        DuoMode2 = MainWindowViewModel.pTAConfigModel!.并联接触器分割的模块数量2!;
        DuoMode3 = MainWindowViewModel.pTAConfigModel!.并联接触器分割的模块数量3!;
        DuoMode4 = MainWindowViewModel.pTAConfigModel!.并联接触器分割的模块数量4!;

        MaxDCVoltageGun2 = MainWindowViewModel.pTAConfigModel!.直流输出最大电压能力2!;
        MinDCVoltageGun2 = MainWindowViewModel.pTAConfigModel!.直流输出最小电压能力2!;
        MaxDCCurrentGun2 = MainWindowViewModel.pTAConfigModel!.直流输出最大电流能力2!;
        MinDCCurrentGun2 = MainWindowViewModel.pTAConfigModel!.直流输出最小电流能力2!;
        TouchScreenSensitivity = MainWindowViewModel.pTAConfigModel!.触摸屏灵敏度 ?? 5;
        SerialNumber = MainWindowViewModel.pTAConfigModel!.充电桩出厂序列号_需要与铭牌一致!;
        RadarSensor = MainWindowViewModel.pTAConfigModel!.雷达传感器 ?? false;
        LiquidCoolingPump = MainWindowViewModel.pTAConfigModel!.液冷泵 ?? false;
        TempSensor = MainWindowViewModel.pTAConfigModel!.温度传感启用 ?? false;
        SignaleWind_1 = MainWindowViewModel.pTAConfigModel!.单个UU模块最大功率1 ?? false;
        SignaleWind_2 = MainWindowViewModel.pTAConfigModel!.单个UU模块最大功率2 ?? false;
        SignaleWind_3 = MainWindowViewModel.pTAConfigModel!.单个UU模块最大功率3 ?? false;
        GBTHelpVoltage = MainWindowViewModel.pTAConfigModel!.GBT_24V辅助电源 ?? false;
        PTBElc = MainWindowViewModel.pTAConfigModel!.PTB_电表! ?? false; 
        ULockState = MainWindowViewModel.pTAConfigModel!.硬件解锁! ?? false;
        DuoColor = Brushes.Black;
    }

}
